cc.Class({
	extends: cc.Component,
	properties: {
		huNode: cc.Node,
		layout: cc.Node,
		item: cc.Node,
		atlas: cc.SpriteAtlas,
	},

	showWinCards: function (cards) {
		this.node.active = true;
		for (let node of this.layout.children) {
			node.destroy();
		}
		let huNode = cc.instantiate(this.huNode);
		huNode.active = true;
		huNode.parent = this.layout;
		for (let item of cards) {
			let node = cc.instantiate(this.item);
			node.active = true;
			node.parent = this.layout;
			let name = "down_"+Math.floor(item.card/10)+"_"+(item.card%10);
			cc.find('Sprite', node).getComponent(cc.Sprite).spriteFrame = this.atlas.getSpriteFrame(name);
			cc.find('Label', node).getComponent(cc.Label).string = item.count+'张';
		}
	},

	unShow: function () {
		this.node.active = false;
	},
});
